Manager API
Epiphany provides a set of static Manager classes as a public API, allowing other mods to interact with the system through Java code.
TIP
All Manager method player parameters are ServerPlayer.
INFO
KubeJS scripts also support the Manager API. See the KubeJS Compat section for details.
AptitudeManager
Manages player aptitude values and Insight Points. Aptitude settlement uses the server's current growth curve; new aptitude and point gains obey the total Insight Point cap.
Query Methods
// Get the player's current aptitude value
long getAptitude(ServerPlayer player)
// Get the player's current Insight Points
int getInsightPoints(ServerPlayer player)
// Get the total Insight Points the player has spent
int getTotalInsightPointsSpent(ServerPlayer player)
// Get total Insight Points (spent + unspent)
long getTotalInsightPoints(ServerPlayer player)
// Whether the player can gain more points; false at the total cap
boolean canGainInsightPoints(ServerPlayer player)
// Get the aptitude threshold for the player's next Insight Point
long getRequiredForNextPoint(ServerPlayer player)Mutation Methods
// Set aptitude (minimum 0)
// Increases use normal level-up settlement and may grant multiple points
// Decreases do not take back Insight Points
// Fires AptitudeChangedEvent, plus level-up and point-change events when points are earned
void setAptitude(ServerPlayer player, long value)
// Add aptitude without applying the player multiplier
// Deduct each point's cost using the growth curve and retain the remainder
// Discard excess aptitude when the total point cap is reached
// Fires AptitudeChangedEvent, AptitudeLevelUpEvent, InsightPointsChangedEvent
void addAptitude(ServerPlayer player, long amount)
// Add aptitude after applying aptitude_gain_multiplier (base + modifiers)
// The scaled amount is rounded down; zero or negative results are ignored
void addAptitudeWithMultiplier(ServerPlayer player, long amount)
// Set available Insight Points (minimum 0), without changing spent points
// Increases are limited to the remaining budget; existing points can still be reduced
// Fires InsightPointsChangedEvent when points change
// Also fires AptitudeChangedEvent if reaching the cap clears aptitude
void setInsightPoints(ServerPlayer player, int value)
// Add or subtract available Insight Points (amount may be negative; minimum balance 0)
// Increases obey the remaining budget; events follow setInsightPoints
void addInsightPoints(ServerPlayer player, int amount)
// Add exactly enough aptitude to reach the next Insight Point threshold
// Uses the same settlement flow and fires normal aptitude and level-up events
// Returns the aptitude actually added, or 0 at the total point cap or if no top-up is needed
long fillAptitude(ServerPlayer player)At the total Insight Point cap, positive aptitude and point grants no longer take effect. Normal spending and the corresponding refunds preserve total points; direct deductions through setInsightPoints or a negative addInsightPoints reduce the total.
Reversible Insight Point Rewards
Custom rewards that need to take points back on removal can use these methods to record and reverse the actual amount granted:
// Record the actual point gain under sourceKey, including grants clipped to 0 by the cap
void applyInsightPointsReward(ServerPlayer player, String sourceKey, int amount)
// Reverse the most recent recorded grant for this sourceKey
void removeInsightPointsReward(ServerPlayer player, String sourceKey)sourceKey identifies the reward's source. Use the same key when applying and removing it. Even if the cap clips a reward, removal takes back only the amount actually granted.
EpiphanyDataUtils
Provides reusable cross-subsystem data operations for Java callers, UI code, and command implementations.
Event behavior
The reset methods intentionally fire no aptitude, Insight Point, or selection events. This matches the behavior of the corresponding /epiphany reset commands.
// Remove all applied Module, Insight, and selected Epiphany rewards
void removeAllRewards(ServerPlayer player)
// Calculate the Insight Point refund for selected Modules and unlocked Insights
// Pure read: does not modify player data
int refundInsightCosts(ServerPlayer player, PlayerEpiphanyData data)
// Remove all rewards and player Epiphany data, then restore SELECTABLE entries
// Equivalent to /epiphany reset all
void resetAll(ServerPlayer player)
// Clear selections and rewards while preserving aptitude
// Refunds selected Module and unlocked Insight costs, then restores SELECTABLE entries
// Equivalent to /epiphany reset select
void resetSelections(ServerPlayer player)ModuleManager
Manages player module data.
Query Methods
// Whether the module is unlocked (can be selected)
boolean isUnlocked(ServerPlayer player, ResourceLocation moduleId)
// Whether the module is currently selected
boolean isSelected(ServerPlayer player, ResourceLocation moduleId)
// Whether the module is completed
boolean isCompleted(ServerPlayer player, ResourceLocation moduleId)
// Number of modules the player currently has selected
int getSelectedModuleCount(ServerPlayer player)
// Configured hard cap on simultaneously selected modules
int getMaxSelectedModules()Mutation Methods
// Set module unlock state
// Fires ModuleUnlockEvent (Pre) and ModuleUnlockedEvent (Post)
void setUnlocked(ServerPlayer player, ResourceLocation moduleId, boolean unlocked)
// Select a module (consumes Insight Points, checks conditions and cap)
// Fires ModuleSelectEvent (Pre) and ModuleSelectedEvent (Post)
// Applies on_select_reward
void select(ServerPlayer player, ResourceLocation moduleId)
// Complete a module (checks if all insights are unlocked, grants Epiphany Slot)
// Fires ModuleCompleteEvent (Pre) and ModuleCompletedEvent (Post)
// Applies on_complete_reward
void complete(ServerPlayer player, ResourceLocation moduleId)
// Force-select (ignores cost and conditions)
// Fires ModuleSelectedEvent (Post)
void forceSelect(ServerPlayer player, ResourceLocation moduleId)
// Force-complete (ignores insight check, grants Epiphany Slot)
// Fires ModuleCompletedEvent (Post)
void forceComplete(ServerPlayer player, ResourceLocation moduleId)
// Reset module (refunds Insight Points, removes rewards)
void resetModule(ServerPlayer player, ResourceLocation moduleId)
// Auto-unlock locked modules whose conditions are met
// skipEventDriven: whether to skip polling
// silent: whether to fire notification messages in NotificationListener
void checkAutoUnlock(ServerPlayer player, boolean skipEventDriven, boolean silent)
// Clean up module data for registry entries that no longer exist
void cleanupOrphanedData(ServerPlayer player)InsightManager
Manages player insight state.
Query Methods
// Whether the insight has been unlocked
boolean isSelected(ServerPlayer player, ResourceLocation insightId)
// Whether the insight's owning module is selected
boolean isModuleSelected(ServerPlayer player, ResourceLocation insightId)Mutation Methods
// Unlock an insight (consumes Insight Points, checks prerequisites)
// Fires InsightSelectEvent (Pre) and InsightSelectedEvent (Post)
void select(ServerPlayer player, ResourceLocation insightId, ResourceLocation moduleId)
// Force-unlock an insight (ignores cost and prerequisites)
void forceSelect(ServerPlayer player, ResourceLocation insightId, ResourceLocation moduleId)
// Reset an insight (refunds Insight Points, removes rewards)
void resetInsight(ServerPlayer player, ResourceLocation insightId)EpiphanyManager
Manages player epiphany state.
Query Methods
// Whether the epiphany is unlocked (can be selected)
boolean isUnlocked(ServerPlayer player, ResourceLocation epiphanyId)
// Whether the epiphany is currently selected
boolean isSelected(ServerPlayer player, ResourceLocation epiphanyId)
// Number of Epiphany Slots the player has unlocked
int getEpiphanySlots(ServerPlayer player)
// Number of Epiphany Slots currently occupied
int getUsedEpiphanySlots(ServerPlayer player)
// Configured hard cap on selectable Epiphanies
int getMaxEpiphanySlots()Mutation Methods
// Set epiphany unlock state
void setUnlocked(ServerPlayer player, ResourceLocation epiphanyId, boolean unlocked)
// Select an epiphany (checks slots and conditions)
// Fires EpiphanySelectEvent (Pre) and EpiphanySelectedEvent (Post)
void select(ServerPlayer player, ResourceLocation epiphanyId)
// Force-select (ignores slots and conditions)
void forceSelect(ServerPlayer player, ResourceLocation epiphanyId)
// Reset an epiphany
void resetEpiphany(ServerPlayer player, ResourceLocation epiphanyId)
// Clean up epiphany data for registry entries that no longer exist
void cleanupOrphanedData(ServerPlayer player)
// Auto-unlock locked epiphanies whose conditions are met
// skipEventDriven: whether to skip polling
// silent: whether to fire notification messages in NotificationListener
void checkAutoUnlock(ServerPlayer player, boolean skipEventDriven, boolean silent)AptitudeSourceManager
Resolves datapack-defined aptitude sources and grants their rewards.
// Resolve one behavior and target without rolling random values, applying the multiplier,
// or modifying player data. Returns the regular and available first-time reward ranges
// and the first-time reward claim key
AptitudeSourceResolver.Resolution resolve(
ServerPlayer sp, ResourceLocation behaviorId,
ResourceLocation targetId, @Nullable Registry<?> registry)
// Grant aptitude: roll regular and first-time rewards separately, add them together,
// then apply the player multiplier once and round down
// On success, record the claim and settle aptitude; returns whether a grant occurred
// behaviorId: behavior ID (e.g., "mymod:foo")
// targetId: target ID (e.g., the entity type that was killed)
// registry: the registry targetId belongs to, used for tag lookup. Can be null
boolean grant(
ServerPlayer sp, ResourceLocation behaviorId,
ResourceLocation targetId, @Nullable Registry<?> registry)Usage example:
@SubscribeEvent
static void onCustomMobKill(LivingDeathEvent event) {
if (!(event.getSource().getEntity() instanceof ServerPlayer sp)) return;
ResourceLocation targetId = BuiltInRegistries.ENTITY_TYPE.getKey(event.getEntity().getType());
AptitudeSourceManager.grant(
sp,
ResourceLocation.fromNamespaceAndPath("mymod", "custom_kill"),
targetId,
BuiltInRegistries.ENTITY_TYPE
);
}AptitudeSourceResolver
Provides the same read-only resolution as AptitudeSourceManager.resolve(...). The returned Resolution describes the possible rewards for the behavior, suitable for queries or previews:
| Method | Returns | Meaning |
|---|---|---|
applies() | boolean | The rules match and allow a positive reward; does not indicate whether the player has remaining point budget |
baseReward() | AptitudeAmount | Regular reward range |
firstReward() | AptitudeAmount | Available first-time reward range; fixed 0 if none is available |
claimKey() | ResourceLocation or null | The key for the available first-time reward claim |
isFixed() | boolean | Whether both rewards are fixed values |
minReward() / maxReward() | long | Minimum / maximum combined reward before applying the player multiplier |
Use AptitudeAmount.min() and max() to inspect each range. The old Resolution.reward() is deprecated and works only for fixed values. Calling it on a random range throws an exception; query the bounds instead.
For example, with a regular reward of [3, 7] and an available first-time reward of 50, minReward() is 53 and maxReward() is 57. Repeated resolve calls neither roll rewards nor consume first-time claims. Use grant to issue the reward.
AptitudeFormula
Queries aptitude costs on the server using the active growth curve. With n = totalSpent + insightPoints, it returns the curve's f(n) cost, rounded up.
The default curve is f(n) = 10 + n. You can also configure segments using constant, linear, quadratic, exponential, and convergent functions. See Growth Curve.
// Calculate the aptitude required for the next Insight Point
// totalSpent: total Insight Points spent
// insightPoints: currently available Insight Points
// Returns: required aptitude value
long calcRequiredAptitude(long totalSpent, int insightPoints)For a specific player, use AptitudeManager.getRequiredForNextPoint(player) directly. Use canGainInsightPoints(player) to check whether further progression is possible.
Processing Pattern
All Manager methods follow a common flow:
1. player.getData(AttachmentType) → read current data
2. Create a new immutable data record (with* methods)
3. player.setData(AttachmentType, newData) → persist and automatically sync to the client
4. NeoForge.EVENT_BUS.post(Event) → fire eventsINFO
PlayerEpiphanyData is an immutable record. All changes use with*() methods to return a new instance.
Method Summary
| Manager | Method | Description | Returns |
|---|---|---|---|
AptitudeManager | getAptitude | Current aptitude | long |
AptitudeManager | getInsightPoints | Available Insight Points | int |
AptitudeManager | getTotalInsightPointsSpent | Total spent Insight Points | int |
AptitudeManager | getTotalInsightPoints | Spent + unspent Insight Points | long |
AptitudeManager | canGainInsightPoints | Whether more points can be gained | boolean |
AptitudeManager | getRequiredForNextPoint | Next point's aptitude requirement | long |
AptitudeManager | setAptitude | Set aptitude | void |
AptitudeManager | addAptitude | Settle aptitude using the growth curve and retain the remainder | void |
AptitudeManager | addAptitudeWithMultiplier | Add aptitude with the player multiplier | void |
AptitudeManager | setInsightPoints | Set available points; increases obey the total cap | void |
AptitudeManager | addInsightPoints | Add or subtract points; increases obey the total cap | void |
AptitudeManager | applyInsightPointsReward | Grant a point reward and record the actual change | void |
AptitudeManager | removeInsightPointsReward | Reverse the latest corresponding point reward | void |
AptitudeManager | fillAptitude | Top up aptitude for the next point | long |
EpiphanyDataUtils | removeAllRewards | Remove all applied rewards | void |
EpiphanyDataUtils | refundInsightCosts | Calculate selection cost refunds | int |
EpiphanyDataUtils | resetAll | Reset all player Epiphany data | void |
EpiphanyDataUtils | resetSelections | Reset selections while preserving aptitude | void |
ModuleManager | isUnlocked | Whether the module is unlocked | boolean |
ModuleManager | isSelected | Whether the module is selected | boolean |
ModuleManager | isCompleted | Whether the module is completed | boolean |
ModuleManager | getSelectedModuleCount | Currently selected module count | int |
ModuleManager | getMaxSelectedModules | Configured cap on selected modules | int |
ModuleManager | setUnlocked | Set unlock state | void |
ModuleManager | select | Select a module | void |
ModuleManager | forceSelect | Force-select a module | void |
ModuleManager | complete | Complete a module | void |
ModuleManager | forceComplete | Force-complete a module | void |
ModuleManager | resetModule | Reset a module | void |
ModuleManager | checkAutoUnlock | Auto-unlock LOCKED modules whose conditions are met | void |
ModuleManager | cleanupOrphanedData | Clean up removed module entries | void |
InsightManager | isSelected | Whether the insight is unlocked | boolean |
InsightManager | isModuleSelected | Whether its owning module is selected | boolean |
InsightManager | select | Unlock an insight | void |
InsightManager | forceSelect | Force-unlock an insight | void |
InsightManager | resetInsight | Reset an insight | void |
EpiphanyManager | isUnlocked | Whether the epiphany is unlocked | boolean |
EpiphanyManager | isSelected | Whether the epiphany is selected | boolean |
EpiphanyManager | getEpiphanySlots | Unlocked Epiphany Slots | int |
EpiphanyManager | getUsedEpiphanySlots | Occupied Epiphany Slots | int |
EpiphanyManager | getMaxEpiphanySlots | Configured Epiphany Slot cap | int |
EpiphanyManager | setUnlocked | Set unlock state | void |
EpiphanyManager | select | Select an epiphany | void |
EpiphanyManager | forceSelect | Force-select an epiphany | void |
EpiphanyManager | resetEpiphany | Reset an epiphany | void |
EpiphanyManager | checkAutoUnlock | Auto-unlock LOCKED epiphanies whose conditions are met | void |
EpiphanyManager | cleanupOrphanedData | Clean up removed epiphany entries | void |
AptitudeSourceManager | grant | Grant aptitude | boolean |
AptitudeSourceManager | resolve | Query reward ranges without rolling | Resolution |
AptitudeSourceResolver | resolve | Resolve behavior rules and available first-time rewards | Resolution |
AptitudeFormula | calcRequiredAptitude | Calculate the next point's aptitude cost | long |